package com.tensquare.notice;

import com.tensquare.notice.config.ApplicationContextProvider;
import com.tensquare.notice.netty.NettyService;
import com.tensquare.util.IdWorker;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;

@SpringBootApplication
@EnableEurekaClient
@EnableFeignClients
public class NoticeApplication {
  public static void main(String[] args) {
    SpringApplication.run(NoticeApplication.class, args);

    // Netty服务启动
    NettyService server = ApplicationContextProvider.getApplicationContext().getBean(NettyService.class);
    server.start(12345);
  }

  @Bean
  public IdWorker idWorker() {
    return new IdWorker(1, 1);
  }
}
